unit RaBase64;

interface

uses
  SysUtils, Classes, Base64Real;

type
  TRaBase64 = class(TComponent)
  private
    fStr: string;
    fCode: string;
    fAuthor: string;
  protected
    { Protected declarations }
  public
    constructor Create(AOwner: TComponent); override;
    function Base64Code: string;
    function UnBase64Code: string;
  published
    property OriginalString: string read fStr write fStr;
    property CodedString: string read fCode write fCode;
    property Author: string read fAuthor;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Rarnu Components', [TRaBase64]);
end;

{ TRaBase64 }

function TRaBase64.Base64Code: string;
begin
  result := Base64Real.MimeEncodeString(OriginalString);
end;

constructor TRaBase64.Create(AOwner: TComponent);
begin
  inherited;
  fStr := '';
  fCode := '';
  fAuthor := 'Rarnu -- http://rarnu.ik8.com';
end;

function TRaBase64.UnBase64Code: string;
begin
  result := Base64Real.MimeDecodeString(CodedString);
end;

end.
